﻿@model IEnumerable<CodeCamp.Models.Email.MailCampaignListItem>

<table>
    <tr>
        <th>Actions</th>
        <th>Status</th>
        <th>Emails</th>
        <th>Sent</th>
        <th>Event</th>
        <th>Recip.Type</th>
        <th>Subject</th>
        <th>Created By</th>
        <th>Created UTC</th>
        <th>Updated By</th>
        <th>Updated UTC</th>
    </tr>

@foreach (var item in Model) {
    <tr>
        <td>
        @{
            bool priorLink = false;
            if (item.EnableEdit)
            {
                priorLink = true;
            @Html.ActionLink("Edit", "EmailCampaignEdit", new { eventName=item.EventShortName, id=item.Id })
            }
            if (item.EnableAddEmail)
            {
                if (priorLink)
                {
                    <text> | </text>
                }
                priorLink = true;
            @Html.ActionLink("Add_Email", "EmailCampaignAddEmail", new { eventName=item.EventShortName, id=item.Id })
            }
            if (item.EnableListEmails)
            {
                if (priorLink)
                {
                    <text> | </text>
                }
                priorLink = true;
            @Html.ActionLink("List_Emails", "EmailCampaignEmailList", new { eventName=item.EventShortName, id=item.Id })
            }
        }
        </td>
        <td>@Html.DisplayTextFor(modelItem => item.Status)</td>
        <td>@Html.DisplayTextFor(modelItem => item.EmailsTotal)</td>
        <td>@Html.DisplayTextFor(modelItem => item.EmailsSent)</td>
        <td>@Html.DisplayFor(modelItem => item.EventShortName)</td>
        <td>@Html.DisplayTextFor(modelItem => item.RecipientType)</td>
        <td>@Html.DisplayFor(modelItem => item.Subject)</td>
        <td>@Html.DisplayFor(modelItem => item.CreatedBy)</td>
        <td>@String.Format("{0:yyyy-MM-dd HH:mm}", item.CreatedUTC)</td>
        <td>@Html.DisplayFor(modelItem => item.UpdatedBy)</td>
        <td>@String.Format("{0:yyyy-MM-dd HH:mm}", item.UpdatedUTC)</td>
    </tr>
}

</table>
